import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Person {
    static {
        System.out.println("This is static initialization block");
    }
    private String name;
    private boolean gender;
    private int age;
    private static int id = -1;

    Person(){
        this.id ++;
        System.out.println("This is constructor");
        System.out.println(name+","+age+","+gender+","+id);
        System.out.println(toString());
    }

    Person(String name,int age,boolean gender){
        this.id ++;
        this.name=name;
        this.age=age;
        this.gender=gender;
    }
    @Override
    public String toString() {
        return "Person [name=" + name + ", age=" + age + ", gender=" + gender + ", id=" + id + "]";
    }
    {
        System.out.printf("This is initialization block, id is %d\n", this.id + 1);
    }

}

public class Main {
    public static void main(String args[]) {
        List<String> list = new ArrayList<>();
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        for (int i = 0; i < n; i ++ ) {
            String name = cin.next();
            int age = cin.nextInt();
            boolean gender = cin.nextBoolean();
            Person person = new Person(name, age, gender);
            list.add(person.toString());
        }

        for (int i = n - 1; i >= 0; i -- ) {
            System.out.println(list.get(i));
        }
        Person a = new Person();
    }
}